/*
 * GF_C_MODEL_STRING_LIKE_LIST_20240913/GF_C_MODEL_STRING_LIKE_LIST.c
 * Created by GF on 2024/09/13.
 */

#include <stdio.h>
#include <string.h> /* strcat(); strcmp(); strcpy(); strlen(); strtok(); */
#include <malloc.h> /* malloc(); realloc(); */
#include "GF_C_MODEL_STRING_LIKE_LIST.h"

char _EMPTY_VALUE[7] = {'(', 'N', 'U', 'L', 'L', ')', '\0'};

char _LIST_SYMBOL_HEAD[2]      = {'[', '\0'};
char _LIST_SYMBOL_TAIL[2]      = {']', '\0'};
char _LIST_SYMBOL_BLANK[2]     = {' ', '\0'};
char _LIST_SYMBOL_DELIMITER[2] = {',', '\0'};

void FREE_CHAR_POINTER_MEMORY(char* CHAR_POINTER) {

    free(CHAR_POINTER);
}

int STRING_SPECIFIED_CHAR_COUNT(char* ORIGINAL_STRING, char CHAR) {

    int INDEX = 0;
    int COUNTER = 0;
    while (ORIGINAL_STRING[INDEX] != '\0') {
        /* Within The Loop Statement */
        if (ORIGINAL_STRING[INDEX] == CHAR) COUNTER++;
        INDEX++;
    }
    return COUNTER;
}

char* STRING_DEL_SPECIFIED_CHAR_ALL(char* ORIGINAL_STRING, char TARGET) {

    int ORIGINAL_LENGTH = strlen(ORIGINAL_STRING);
    char* TREATED_STRING = (char*)malloc(sizeof(char) * ORIGINAL_LENGTH);
    strcpy(TREATED_STRING, ORIGINAL_STRING);
    /* ---------------------------------------------- */
    int FIND = 0;
    int DELETED = 0;
    while (TREATED_STRING[FIND] != '\0') {
        /* Within The Loop Statement */
        if (TREATED_STRING[FIND] == TARGET) {
            /* Within The Conditional Statement */
            int A1 = FIND;
            int B1 = (A1 + 1);
            TREATED_STRING[A1] = TREATED_STRING[B1];
            /* ...................................... */
            int A2 = B1;
            int B2 = (A2 + 1);
            while (TREATED_STRING[A2] != '\0') {
                /* Within The Loop Statement */
                TREATED_STRING[A2] = TREATED_STRING[B2];
                TREATED_STRING = (char*)realloc(TREATED_STRING, sizeof(char) * (ORIGINAL_LENGTH - DELETED));
                A2++;
                B2++;
            }
            DELETED = (DELETED + 1);
            continue;
        }
        FIND++;
    }
    return TREATED_STRING;
}

char* STRING_DEL_CHAR_BY_INDEX(char* ORG_STR, int INDEX) {

    /*
     * Need Functions:
     * int strlen(char*);
     */

    int LEN_OF_ORG_STR = strlen(ORG_STR);

    if (LEN_OF_ORG_STR == 0) {

        printf("[Caution] \"STRING_DEL_CHAR_BY_INDEX\": String is Empty.\n");

        return ORG_STR;

    } else if (INDEX >= LEN_OF_ORG_STR) { /* Array Index Starts from 0 */

        printf("[Caution] \"STRING_DEL_CHAR_BY_INDEX\": Index is Out of Range.\n");

        return ORG_STR;

    } else if ((INDEX / -1) > LEN_OF_ORG_STR) {

        printf("[Caution] \"STRING_DEL_CHAR_BY_INDEX\": Index is Out of Range.\n");

        return ORG_STR;

    } else if (INDEX < 0) { /* Remove Character from The End */

        int NUM_OF_CHAR_IN_ORG_STR = (LEN_OF_ORG_STR + 1);
        int NUM_OF_CHAR_IN_NEW_STR = (NUM_OF_CHAR_IN_ORG_STR - 1);

        char* TRANSITION_STR = (char*)malloc(sizeof(char*) * NUM_OF_CHAR_IN_ORG_STR);
        strcpy(TRANSITION_STR, ORG_STR);

        for (int L = (LEN_OF_ORG_STR + INDEX - 1), R = (LEN_OF_ORG_STR + INDEX); L >= 0; L--, R--) TRANSITION_STR[R] = TRANSITION_STR[L];

        char* NEW_STR = (char*)malloc(sizeof(char*) * NUM_OF_CHAR_IN_NEW_STR);
        strcpy(NEW_STR, (TRANSITION_STR + 1));

        free(TRANSITION_STR);

        return NEW_STR;

    } else {

        /*
         * "NUM_OF_CHAR_IN_ORG_STR" Includes '\0' .
         * "LEN_OF_ORG_STRA" does not Include '\0' .
         */

        int NUM_OF_CHAR_IN_ORG_STR = (LEN_OF_ORG_STR + 1);
        int NUM_OF_CHAR_IN_NEW_STR = (NUM_OF_CHAR_IN_ORG_STR - 1);
        int IDX_OF_END_SYMBOL_IN_ORG_STR = (NUM_OF_CHAR_IN_ORG_STR - 1); /* Array Index Starts from 0 */
        int IDX_OF_END_SYMBOL_IN_NEW_STR = (IDX_OF_END_SYMBOL_IN_ORG_STR - 1);

        char* NEW_STR = (char*)malloc(sizeof(char*) * NUM_OF_CHAR_IN_ORG_STR);
        strcpy(NEW_STR, ORG_STR);

        for (int L = INDEX, R = (INDEX + 1); R <= (LEN_OF_ORG_STR - 1); L++, R++) NEW_STR[L] = NEW_STR[R];

        NEW_STR[IDX_OF_END_SYMBOL_IN_NEW_STR] = '\0';

        /* Reallocate the memory length pointed to by "char Poiner" */
        NEW_STR=(char*)realloc(NEW_STR, sizeof(char) * NUM_OF_CHAR_IN_NEW_STR);

        return NEW_STR;
    }
}

char* STRING_TOKENS_REVERSE(char* STRING, char* DELIMITERS) {

    /*
     * The "STRING_TOKENS_REVERSE" Function is Used to Split Strings,
     * But it Breaks The Original String During The Splitting Process Because it Modifies The String by Replacing The Delimiter.
     * This is Because "STRING_TOKENS_REVERSE" Saves The Search Start Position for The Next Call by Modifying The Delimiter (Such as a Space) in The String.
     */

    static char* PREVIOUS_POSITION = NULL;

    /* ---------------------------------------------- */

	if (STRING == NULL && PREVIOUS_POSITION == NULL) return NULL;

    /* ---------------------------------------------- */

	if (STRING == NULL) { /* Get The 2nd, 3rd, 4th, ... Substring */
        /* Within The Conditional Statement */
        STRING = PREVIOUS_POSITION;
        /* .......................................... */
        int LENGTH_OF_DELIMS = strlen(DELIMITERS);
        int LENGTH_OF_STRING = strlen(STRING);
        /* .......................................... */
        /* Pointer Points to The Head: "[H]ello World" */
		char* POINTER_MOVING = STRING;
        /* Pointer Points to The Tail: "Hello Worl[d]" */
        char* POINTER_ENDING = POINTER_MOVING + (LENGTH_OF_STRING - 1);
        
        int MOVED_DISTANCE = 1;
        /* .......................................... */
        while (MOVED_DISTANCE <= LENGTH_OF_STRING) {
            
            for (int i = 0; i <= (LENGTH_OF_DELIMS - 1); i++) {
                if (*POINTER_ENDING == DELIMITERS[i]) {
                    *POINTER_ENDING = '\0';
                    return (POINTER_ENDING + 1);
                }
            }
            POINTER_ENDING--;
            MOVED_DISTANCE++;
        }
		char* RESULT = PREVIOUS_POSITION;
		PREVIOUS_POSITION = NULL;
		return RESULT;

	} else { /* Get The 1st Substring */
        /* Within The Conditional Statement */
        int LENGTH_OF_DELIMS = strlen(DELIMITERS);
        int LENGTH_OF_STRING = strlen(STRING);
        /* .......................................... */
        /* Pointer Points to The Head: "[H]ello World" */
		char* POINTER_MOVING = STRING;
        /* Pointer Points to The Tail: "Hello Worl[d]" */
        char* POINTER_ENDING = POINTER_MOVING + (LENGTH_OF_STRING - 1);
        
        int MOVED_DISTANCE = 1;
        /* .......................................... */
        while (MOVED_DISTANCE <= LENGTH_OF_STRING) {
            
            for (int i = 0; i <= (LENGTH_OF_DELIMS - 1); i++) {
                if (*POINTER_ENDING == DELIMITERS[i]) {
                    *POINTER_ENDING = '\0';
                    PREVIOUS_POSITION = POINTER_MOVING; /* Assign String to Static Variable */
                    return (POINTER_ENDING + 1);
                }
            }
            POINTER_ENDING--;
            MOVED_DISTANCE++;
        }
		char* RESULT = PREVIOUS_POSITION;
		PREVIOUS_POSITION = NULL;
		return RESULT;
	}
}

char* STRING_TOKENS_REVERSE_BY_STRING(char* STRING, char* DELIMITER) {

    /*
     * The "STRING_TOKENS_REVERSE_BY_STRING" Function is Used to Split Strings,
     * But it Breaks The Original String During The Splitting Process Because it Modifies The String by Replacing The Delimiter.
     * This is Because "STRING_TOKENS_REVERSE_BY_STRING" Saves The Search Start Position for The Next Call by Modifying The Delimiter (Such as a Space) in The String.
     */

    static char* PREVIOUS_POSITION = NULL;

    /* ---------------------------------------------- */

	if (STRING == NULL && PREVIOUS_POSITION == NULL) return NULL;

    /* ---------------------------------------------- */

	if (STRING == NULL) { /* Get The 2nd, 3rd, 4th, ... Substring */
        /* Within The Conditional Statement */
        STRING = PREVIOUS_POSITION;
        /* .......................................... */
        int LENGTH_OF_DELIM  = strlen(DELIMITER);
        int LENGTH_OF_STRING = strlen(STRING);
        /* .......................................... */
        /* Pointer Points to The Head: "[H]ello World" */
		char* POINTER_MOVING = STRING;
        /* Pointer Points to The Tail: "Hello Worl[d]" */
        char* POINTER_ENDING = POINTER_MOVING + (LENGTH_OF_STRING - 1);
        
        int MOVED_DISTANCE = 1;
        /* .......................................... */
        while (MOVED_DISTANCE <= LENGTH_OF_STRING) {
            
            if (MOVED_DISTANCE >= LENGTH_OF_DELIM) {
                
                char* FINDED_DELIMIT = (char*)malloc(sizeof(char) * (MOVED_DISTANCE + 1));
                strcpy(FINDED_DELIMIT, POINTER_ENDING);
                /* Add an Ending Symbol After The Delimiter: "of The World" => "of\0" */
                *(FINDED_DELIMIT + (LENGTH_OF_DELIM - 1) + 1) = '\0';
                
                if (strcmp(DELIMITER, FINDED_DELIMIT) == 0) {
                
                    char* TOKEN = (POINTER_ENDING + LENGTH_OF_DELIM);
                    /* .............................. */
                    *POINTER_ENDING = '\0';
                    /* .............................. */
                    free(FINDED_DELIMIT);
                    /* .............................. */
                    return TOKEN;

                } else {

                    free(FINDED_DELIMIT);
                }
            }
            POINTER_ENDING--;
            MOVED_DISTANCE++;
        }
		char* RESULT = PREVIOUS_POSITION;
		PREVIOUS_POSITION = NULL;
		return RESULT;

	} else { /* Get The 1st Substring */
        /* Within The Conditional Statement */
        int LENGTH_OF_DELIM  = strlen(DELIMITER);
        int LENGTH_OF_STRING = strlen(STRING);
        /* .......................................... */
        /* Pointer Points to The Head: "[H]ello World" */
		char* POINTER_MOVING = STRING;
        /* Pointer Points to The Tail: "Hello Worl[d]" */
        char* POINTER_ENDING = POINTER_MOVING + (LENGTH_OF_STRING - 1);
        
        int MOVED_DISTANCE = 1;
        /* .......................................... */
        while (MOVED_DISTANCE <= LENGTH_OF_STRING) {
            
            if (MOVED_DISTANCE >= LENGTH_OF_DELIM) {
                
                char* FINDED_DELIMIT = (char*)malloc(sizeof(char) * (MOVED_DISTANCE + 1));
                strcpy(FINDED_DELIMIT, POINTER_ENDING);
                /* Add an Ending Symbol After The Delimiter: "of The World" => "of\0" */
                *(FINDED_DELIMIT + (LENGTH_OF_DELIM - 1) + 1) = '\0';
                
                if (strcmp(DELIMITER, FINDED_DELIMIT) == 0) {
                
                    char* TOKEN = (POINTER_ENDING + LENGTH_OF_DELIM);
                    /* .............................. */
                    *POINTER_ENDING = '\0';
                    PREVIOUS_POSITION = POINTER_MOVING; /* Assign String to Static Variable */
                    /* .............................. */
                    free(FINDED_DELIMIT);
                    /* .............................. */
                    return TOKEN;

                } else {

                    free(FINDED_DELIMIT);
                }
            }
            POINTER_ENDING--;
            MOVED_DISTANCE++;
        }
		char* RESULT = PREVIOUS_POSITION;
		PREVIOUS_POSITION = NULL;
		return RESULT;
	}
}

/* String_Like List: Append Element */
char* STRING_LIKE_LIST_APPEND_ELEMENT(char* STRING_LIKE_LIST, char* VALUE) {

    /*
     * Need Functions:
     * int   strlen(char*);
     * char* STRING_DEL_SPECIFIED_CHAR_ALL(char*, char*);
     *
     * Illustration:
     * >>>> char* List = "[1, 2, 3]";
     * >>>> List = STR_FORM_LIST_APPEND_ELE(List, "50");
     * >>>> printf("%s\n", List);
     * OUT: [1, 2, 3, 50]
     */

    char* STRING_LIKE_LIST_CTNT = STRING_DEL_SPECIFIED_CHAR_ALL(STRING_LIKE_LIST, _LIST_SYMBOL_HEAD[0]);
          STRING_LIKE_LIST_CTNT = STRING_DEL_SPECIFIED_CHAR_ALL(STRING_LIKE_LIST_CTNT, _LIST_SYMBOL_TAIL[0]);
    /* .............................................. */
    int   STRING_LIKE_LIST_CTNT_LEN = strlen(STRING_LIKE_LIST_CTNT);

    /* ---------------------------------------------- */

    if (STRING_LIKE_LIST_CTNT_LEN == 0) {

        int VALUE_LENTH = strlen(VALUE);

        char PART_4[1] = {'\0'};

        int POINTER_POSITION_OF_PART_1 = _POINTER_START_INDEX;
        int POINTER_POSITION_OF_VALUE  = (POINTER_POSITION_OF_PART_1 + 1); /* Location of Value */
        int POINTER_POSITION_OF_PART_3 = (POINTER_POSITION_OF_VALUE - 1 + VALUE_LENTH + 1);
        int POINTER_POSITION_OF_PART_4 = (POINTER_POSITION_OF_PART_3 + 1);

        /* .......................................... */

        char* NEW_STR_FORM_LIST = (char*)malloc(sizeof(char) * (VALUE_LENTH + 1 + 1 + 1));

        strcpy((NEW_STR_FORM_LIST + POINTER_POSITION_OF_PART_1), _LIST_SYMBOL_HEAD);
        strcpy((NEW_STR_FORM_LIST + POINTER_POSITION_OF_VALUE),  VALUE );
        strcpy((NEW_STR_FORM_LIST + POINTER_POSITION_OF_PART_3), _LIST_SYMBOL_TAIL);
        strcpy((NEW_STR_FORM_LIST + POINTER_POSITION_OF_PART_4), PART_4);

        /* .......................................... */

        free(STRING_LIKE_LIST_CTNT);

        return NEW_STR_FORM_LIST;

    } else {

        int VALUE_LENTH = strlen(VALUE);

        char PART_1[1] = {'['};
        char PART_3[1] = {','};
        char PART_4[1] = {' '};
        char PART_6[1] = {']'};
        char PART_7[1] = {'\0'};

        int POINTER_POSITION_OF_PART_1  = _POINTER_START_INDEX;
        int POINTER_POSITION_OF_CONTENT = (POINTER_POSITION_OF_PART_1  + 1); /* Location of Content of List */
        int POINTER_POSITION_OF_PART_3  = (POINTER_POSITION_OF_CONTENT - 1 + STRING_LIKE_LIST_CTNT_LEN + 1);
        int POINTER_POSITION_OF_PART_4  = (POINTER_POSITION_OF_PART_3  + 1);
        int POINTER_POSITION_OF_VALUE   = (POINTER_POSITION_OF_PART_4  + 1); /* Location of Value */
        int POINTER_POSITION_OF_PART_6  = (POINTER_POSITION_OF_VALUE   + VALUE_LENTH);
        int POINTER_POSITION_OF_PART_7  = (POINTER_POSITION_OF_PART_6  + 1);

        /* .......................................... */

        char* NEW_STR_FORM_LIST = (char*)malloc(sizeof(char) * (STRING_LIKE_LIST_CTNT_LEN + VALUE_LENTH + 1 + 1 + 1 + 1 + 1));

        strcpy((NEW_STR_FORM_LIST + POINTER_POSITION_OF_PART_1),  _LIST_SYMBOL_HEAD);
        strcpy((NEW_STR_FORM_LIST + POINTER_POSITION_OF_CONTENT), STRING_LIKE_LIST_CTNT);
        strcpy((NEW_STR_FORM_LIST + POINTER_POSITION_OF_PART_3),  PART_3);
        strcpy((NEW_STR_FORM_LIST + POINTER_POSITION_OF_PART_4),  PART_4);
        strcpy((NEW_STR_FORM_LIST + POINTER_POSITION_OF_VALUE),   VALUE);
        strcpy((NEW_STR_FORM_LIST + POINTER_POSITION_OF_PART_6),  _LIST_SYMBOL_TAIL);
        strcpy((NEW_STR_FORM_LIST + POINTER_POSITION_OF_PART_7),  PART_7);

        /* .......................................... */

        free(STRING_LIKE_LIST_CTNT);

        return NEW_STR_FORM_LIST;
    }
}

/* String_Like List: Extract Element by Index */
char* STRING_LIKE_LIST_EXTRACT_ELEMENT_BY_INDEX(char* STRING_LIKE_LIST, int INDEX) {

    /*
     * Need Functions:
     * int   strlen(char*);
     * char* STRING_DEL_SPECIFIED_CHAR_ALL(char*, char);
     * char* STRING_TOKENS_REVERSE(char*, char*);
     *
     * Illustration:
     * >>>> char* List = "[1, 2, 3, 4, 5]";
     * >>>> char* Result = STRING_LIKE_LIST_EXTRACT_ELEMENT_BY_INDEX(List, 3);
     * >>>> printf("%s\n", Result);
     * OUT: 4
     */

    char* STRING_LIKE_LIST_CTNT = STRING_DEL_SPECIFIED_CHAR_ALL(STRING_LIKE_LIST, _LIST_SYMBOL_HEAD[0]);
          STRING_LIKE_LIST_CTNT = STRING_DEL_SPECIFIED_CHAR_ALL(STRING_LIKE_LIST_CTNT, _LIST_SYMBOL_TAIL[0]);
    /* .............................................. */
    int   STRING_LIKE_LIST_CTNT_LEN = strlen(STRING_LIKE_LIST_CTNT);

    /* ---------------------------------------------- */

    if (STRING_LIKE_LIST_CTNT_LEN == 0) {

        printf("[Caution] \"STRING_LIKE_LIST_EXTRACT_ELEMENT_BY_INDEX\": String Form List is Empty.\n");

        free(STRING_LIKE_LIST_CTNT);

        return _EMPTY_VALUE;

    } else if (INDEX == _ARRAY_START_INDEX){
        /* Within The Conditional Statement */
        char* TOKEN;
        char* FRUIT;
        /* .......................................... */
        TOKEN = strtok(STRING_LIKE_LIST_CTNT, _LIST_SYMBOL_DELIMITER);
        /* .......................................... */
        FRUIT = (char*)malloc(sizeof(char) * (strlen(TOKEN) + 1));
        strcpy(FRUIT, TOKEN);
        FRUIT = STRING_DEL_SPECIFIED_CHAR_ALL(FRUIT, _LIST_SYMBOL_BLANK[0]);
        /* .......................................... */
        free(STRING_LIKE_LIST_CTNT);
        return FRUIT;
    
    } else if (INDEX == -1){
        /* Within The Conditional Statement */
        char* TOKEN;
        char* FRUIT;
        /* .......................................... */
        TOKEN = STRING_TOKENS_REVERSE(STRING_LIKE_LIST_CTNT, _LIST_SYMBOL_DELIMITER);
        /* .......................................... */
        FRUIT = (char*)malloc(sizeof(char) * (strlen(TOKEN) + 1));
        strcpy(FRUIT, TOKEN);
        FRUIT = STRING_DEL_SPECIFIED_CHAR_ALL(FRUIT, _LIST_SYMBOL_BLANK[0]);
        /* .......................................... */
        free(STRING_LIKE_LIST_CTNT);
        return FRUIT;

    } else if (INDEX <= -2) {
        /* Within The Conditional Statement */
        int DELIMITER_COUNTER = -1;
        /* .......................................... */
        char* TOKEN;
        char* FRUIT;
        /* .......................................... */
        TOKEN = STRING_TOKENS_REVERSE(STRING_LIKE_LIST_CTNT, _LIST_SYMBOL_DELIMITER);
        /* .......................................... */
        while (TOKEN != NULL) {
            /* Within The Loop Statement */
            TOKEN = STRING_TOKENS_REVERSE(NULL, _LIST_SYMBOL_DELIMITER);
            if (TOKEN == NULL)
                break;
            if ((DELIMITER_COUNTER - 1) == INDEX) {
                FRUIT = (char*)malloc(sizeof(char) * (strlen(TOKEN) + 1));
                strcpy(FRUIT, TOKEN);
                FRUIT = STRING_DEL_SPECIFIED_CHAR_ALL(FRUIT, _LIST_SYMBOL_BLANK[0]);
                break;
            }
            DELIMITER_COUNTER = (DELIMITER_COUNTER - 1);
        }
        free(STRING_LIKE_LIST_CTNT);
        return FRUIT;

    } else {
        /* Within The Conditional Statement */
        int DELIMITER_COUNTER = 0;
        /* .......................................... */
        char* TOKEN;
        char* FRUIT;
        /* .......................................... */
        TOKEN = strtok(STRING_LIKE_LIST_CTNT, _LIST_SYMBOL_DELIMITER);
        /* .......................................... */
        while (TOKEN != NULL) {
            /* Within The Loop Statement */
            TOKEN = strtok(NULL, _LIST_SYMBOL_DELIMITER);
            if (TOKEN == NULL)
                break;
            if ((DELIMITER_COUNTER + 1) == INDEX) {
                FRUIT = (char*)malloc(sizeof(char) * (strlen(TOKEN) + 1));
                strcpy(FRUIT, TOKEN);
                FRUIT = STRING_DEL_SPECIFIED_CHAR_ALL(FRUIT, _LIST_SYMBOL_BLANK[0]);
                break;
            }
            DELIMITER_COUNTER = (DELIMITER_COUNTER + 1);
        }
        free(STRING_LIKE_LIST_CTNT);
        return FRUIT;
    }
}

/* String_Like List: Replace Value by Index */
char* STRING_LIKE_LIST_REPLACE_VALUE_BY_INDEX(char* STRING_LIKE_LIST, int INDEX, char* VALUE) {

    /*
     * Caution:
     * strcpy(); The Replication Result of 'strcpy();' Contains '\0'
     * strlen(); The Calculation Result of 'strlen();' does not Include '\0'
     */

    int ORIG_CHAR_NUMBER = strlen(STRING_LIKE_LIST);
    int LIST_ELEM_NUMBER = STRING_SPECIFIED_CHAR_COUNT(STRING_LIKE_LIST, _LIST_SYMBOL_DELIMITER[0]) + 1;
    /* ---------------------------------------------- */
    char* HANDLING_STRING_LIST = (char*)malloc(sizeof(char) * (ORIG_CHAR_NUMBER + 1));
    char* EVENTUAL_STRING_LIST = (char*)malloc(sizeof(char) * 1);
    /* ---------------------------------------------- */
    /* 'strtok()' Will Insert '\0', Which May Affect 'STRING_LIKE_LIST' */
    strcpy(HANDLING_STRING_LIST, STRING_LIKE_LIST);
    /* .............................................. */
    EVENTUAL_STRING_LIST[0] = '\0';

    if (INDEX == _ARRAY_START_INDEX) {
        /* Within The Conditional Statement */
        char* TOKEN = strtok(HANDLING_STRING_LIST, _LIST_SYMBOL_DELIMITER);
        /* .......................................... */
        strcat(EVENTUAL_STRING_LIST, _LIST_SYMBOL_HEAD);
        strcat(EVENTUAL_STRING_LIST, VALUE);
        /* .......................................... */
        while (TOKEN != NULL) {
            /* Within The Loop Statement */
            TOKEN = strtok(NULL, _LIST_SYMBOL_DELIMITER);
            if (TOKEN == NULL) break;
            strcat(EVENTUAL_STRING_LIST, _LIST_SYMBOL_DELIMITER);
            strcat(EVENTUAL_STRING_LIST, TOKEN);
        }
        free(HANDLING_STRING_LIST);
        return EVENTUAL_STRING_LIST;
    }
    
    if (_ARRAY_START_INDEX < INDEX && INDEX < (LIST_ELEM_NUMBER - 1)) {
        /* Within The Conditional Statement */
        int   DELIMITER_COUNTER = _ARRAY_START_INDEX + 1;
        /* .......................................... */
        char* TOKEN = strtok(HANDLING_STRING_LIST, _LIST_SYMBOL_DELIMITER);
        /* .......................................... */
        strcat(EVENTUAL_STRING_LIST, TOKEN);
        /* .......................................... */
        while (TOKEN != NULL) {
            /* Within The Loop Statement */
            TOKEN = strtok(NULL, _LIST_SYMBOL_DELIMITER);
            if (TOKEN == NULL) break;
            if (DELIMITER_COUNTER == INDEX) {
                strcat(EVENTUAL_STRING_LIST, _LIST_SYMBOL_DELIMITER);
                strcat(EVENTUAL_STRING_LIST, _LIST_SYMBOL_BLANK);
                strcat(EVENTUAL_STRING_LIST, VALUE);
            } else {
                strcat(EVENTUAL_STRING_LIST, _LIST_SYMBOL_DELIMITER);
                strcat(EVENTUAL_STRING_LIST, TOKEN);
            }
            DELIMITER_COUNTER = (DELIMITER_COUNTER + 1);
        }
        free(HANDLING_STRING_LIST);
        return EVENTUAL_STRING_LIST;
    }

    if (INDEX == (LIST_ELEM_NUMBER - 1)) {
        /* Within The Conditional Statement */
        /* .......................................... */
        int   DELIMITER_COUNTER = _ARRAY_START_INDEX + 1;
        /* .......................................... */
        char* TOKEN = strtok(HANDLING_STRING_LIST, _LIST_SYMBOL_DELIMITER);
        /* .......................................... */
        strcat(EVENTUAL_STRING_LIST, TOKEN);
        /* .......................................... */
        while (TOKEN != NULL) {
            /* Within The Loop Statement */
            TOKEN = strtok(NULL, _LIST_SYMBOL_DELIMITER);
            if (TOKEN == NULL) break;
            if (DELIMITER_COUNTER == INDEX) {
                strcat(EVENTUAL_STRING_LIST, _LIST_SYMBOL_DELIMITER);
                strcat(EVENTUAL_STRING_LIST, _LIST_SYMBOL_BLANK);
                strcat(EVENTUAL_STRING_LIST, VALUE);
                strcat(EVENTUAL_STRING_LIST, _LIST_SYMBOL_TAIL);
            } else {
                strcat(EVENTUAL_STRING_LIST, _LIST_SYMBOL_DELIMITER);
                strcat(EVENTUAL_STRING_LIST, TOKEN);
            }
            DELIMITER_COUNTER = (DELIMITER_COUNTER + 1);
        }
        free(HANDLING_STRING_LIST);
        return EVENTUAL_STRING_LIST;
    }
}
